package team.lourd.network.system.config;


import org.springframework.batch.core.Job;
import org.springframework.batch.core.launch.NoSuchJobException;
import org.springframework.batch.test.JobLauncherTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import team.lourd.network.system.batch.helloworld.HelloWorldJobConfig;

@Configuration
@Import({BatchConfig.class, HelloWorldJobConfig.class})
public class BatchTestConfig {

    @Autowired
    private Job helloWorlJob;

    @Bean
    JobLauncherTestUtils jobLauncherTestUtils()
            throws NoSuchJobException {
        JobLauncherTestUtils jobLauncherTestUtils =
                new JobLauncherTestUtils();
        jobLauncherTestUtils.setJob(helloWorlJob);

        return jobLauncherTestUtils;
    }
}